package cn.cvs.service.pet;

import cn.cvs.dao.apply.ApplyMapper;
import cn.cvs.dao.pet.PetMapper;
import cn.cvs.pojo.Apply;
import cn.cvs.pojo.Pet;
import cn.cvs.pojo.Supplier;
import cn.cvs.pojo.Type;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PetServiceImpl implements PetService {
	@Resource
	private ApplyMapper applyMapper;

	@Resource
	private PetMapper petMapper;


	@Override
	public boolean add(Apply apply) throws Exception {
		return false;
	}



	@Override
	public List<Pet> getList(int pageIndex, int pageSize) throws Exception {
		int pageBegin = (pageIndex-1)*pageSize;
		return petMapper.selectList( pageBegin, pageSize);
	}
	@Override
	public int getCount() throws Exception {
		return petMapper.selectCount();
	}

	@Override
	public Supplier getById(Integer id) throws Exception {
		return null;
	}

	@Override
	public int update(Apply apply) throws Exception {
		return applyMapper.update(apply);
	}

	@Override
	public boolean deleteById(Integer id) throws Exception {
		return false;
	}

	@Override
	public Pet getPetById(Integer id) throws Exception {
		return petMapper.selectById(id);
	}

	@Override
	public List<Pet> selectAllList(Integer typeId, Integer pageIndex, Integer pageSize) {
		int pageBean = (pageIndex - 1) * pageSize;
		return petMapper.selectAllList(typeId, pageBean, pageSize);
	}

	@Override
	public int count(Integer typeId) {
		return petMapper.count(typeId);
	}

	@Override
	public int addPet(Pet pet) {
		return petMapper.addPet(pet);
	}

	@Override
	public int updatePetById(Pet pet) {
		return petMapper.updatePetById(pet);
	}

	@Override
	public int deletePetById(Integer id) {
		return petMapper.deletePetById(id);
	}

	@Override
	public Pet selectPetById(Integer id) {
		return petMapper.selectPetById(id);
	}

	@Override
	public List<Type> list() {
		return petMapper.list();
	}


}
